A05 - Three Cards
https://atcoder.jp/contests/tessoku-book/tasks/tessoku_book_e
code: python
n, k = map(int, input().split())
ans = 0
for x in range(1, n+1):
for y in range(1, n+1):
if k - x - y > 0 and k - x - y < n + 1:
ans += 1
print(ans)